<?php if (count($product_newest) > 0) :?>
<h1>Hàng mới về</h1>
<ul id="product_list" class="bordercolor grid">
    <?php foreach($product_newest as $key => $value) :
    $product_link = base_url('san-pham/'.$value['product_id'].'_'.url_friendly($value['title']).'.html');
    ?>
    <li class="ajax_block_product bordercolor">
        <a href="<?php echo $product_link;?>" class="product_img_link" title="<?php echo $value['title'];?>">
            <img onerror="ImgError(this);" width="170" height="170" src="<?php echo render_image('/uploads/product/'.$value['product_id'].'/'.md5($value['product_id']).'.jpg', 170, 170, '1.1');?>" alt="<?php echo $value['title'];?>" />
        </a>
        <div class="center_block">
            <div class="product_flags">
                <span class="new"><?php echo $value['status_flag'] == 0 ? 'Cũ' : 'Mới';?>!</span>
                <span class="availability bordercolor"><?php echo $value['quantity'] > 0 ? 'Còn hàng' : 'Hết hàng';?></span>
            </div>
            <h3><a class="product_link" href="<?php echo $product_link;?>" title="<?php echo $value['title'];?>"><?php echo $value['title'];?></a></h3>
            <p class="product_desc">
                <a class="product_descr" href="#" title="<?php echo $value['intro'];?>"></a>
            </p>
            <p>
                <a class="product_descr" href="#" title="<?php echo $value['intro'];?>"><?php echo $value['intro'];?></a>
            </p>
        </div>
        <div class="right_block bordercolor">
            <span class="price">
                <?php if ($value['price_new'] < $value['price_old']):?>
                    <span style="text-decoration: line-through; font-size: 16px; font-weight: bold;"><?php echo currency_format($value['price_old']);?> VND</span><br />
                    <span style="font-size: 16px;  font-weight: bold; <?php echo $value['price_new'] ? 'color: red;' : '';?>"><?php echo currency_format($value['price_new']);?> VND</span>
                <?php else :?>
                    <?php echo currency_format($value['price_old']);?> VND
                <?php endif;?>
            </span>
            <!--
            <p class="compare checkbox">
                <input type="checkbox" class="comparator" id="comparator_item_list<?php echo $value['product_id'];?>" value="comparator_item_<?php echo $value['product_id'];?>">
                <label for="comparator_item_list<?php echo $value['product_id'];?>">So sánh</label>
            </p>
            -->
            <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_<?php echo $value['product_id'];?>" href="<?php echo base_url();?>" title="Thêm vào giỏ">Thêm vào giỏ</a>
            <a class="exclusive" href="<?php echo $product_link;?>" title="View">Xem</a>
        </div>
    </li>
    <?php endforeach;?>
</ul>
<?php endif;?>